<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<link rel="stylesheet" type="text/css" href="style/tip.css" />
<script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
<title>问卷管理</title>
</head>
<body>
	<div id="wrap">
		<div id="public_head">
        	
        </div>
        <div class="m_search">
        <form method='post' action=''>
        <?php if(CSM_UNIT_ID>0){?>
        	<input class="btn_add" name="" type="button" value="" onclick="document.location.href='/index.php?c=quesnr&a=add'" />
        <?php }?>
          
        	时间范围 
        		<input class="Wdate" name='begtime' value='<?php echo $bt;?>' type="text" onClick="WdatePicker()">
        	 > <input class="Wdate" name='endtime' value='<?php echo $et;?>' type="text" onClick="WdatePicker()"> 
        	 <select class="select" name="did">
        	 	<option value='0'>所有科室</option>
        	 	<?php 
        	   	foreach ($dep as $k=>$v){
        	   		$flag = '';
        	   		if($did == $k){
        	   			$flag = 'selected';
        	   		}
        	   		echo "<option value='".$k."' ".$flag.">".$v."</option>";
        	   	}
        	   ?>
        	 </select> 
        	 <select class="select" name="cate">
        	   <option value='0'>所有分类</option>
        	   <?php 
        	   if(is_array($allcate) && count($allcate)>0){
        	   	foreach ($allcate as $k=>$v){
        	   		$flag = '';
        	   		if($cid == $k){
        	   			$flag = 'selected';
        	   		}
        	   		echo "<option value='".$k."' ".$flag.">".$v."</option>";
        	   	}}
        	   ?>
        	  </select> 
        	  <select class="select" name="state">
        	  
        	    <option value='0'>所有状态</option>
        	    <option value='1'<?php if($state==1) echo 'selected';?>>未添加题目</option>
        	    <option value='2'<?php if($state==2) echo 'selected';?>>待发布</option>
        	    <option value='3'<?php if($state==3) echo 'selected';?>>已发布</option>
        	    <option value='4'<?php if($state==4) echo 'selected';?>>自动关闭</option>
        	    <option value='5'<?php if($state==5) echo 'selected';?>>后台关闭</option>
        	   </select> 
        	   <input type="text" class="qi_text" name="title" value="<?php echo $title?$title:'请输入查询关键词';?>" onfocus="this.select();" />
        	   <input class="btn_search" name="sel_sub" type="submit" value="" />
          </form>
        </div>
        <div class="m_content">
        	<table class="qi_table" width="0" border="0" cellpadding="0" cellspacing="1">
              <tr><th >ID</th><th>问卷标题</th><th>开始时间</th><th>结束时间</th><th>状态</th><th>分类</th><th>科室</th><th width="18%">操作</th></tr>
              <?php 
              	if(is_array($allquesnr)&&count($allquesnr)>0){
              		$i=1+($page-1)*$pagesize;
              		foreach ($allquesnr as $v){
              ?>
              <tr>
              	<td><?php echo $i++?></td>
              	<td><?php echo str_replace($title, '<font style="color:red;font-weight:bold;">'.$title.'</font>&nbsp;', $v['TITLE'])?></td>
              	<td><?php echo $v['START_TIME']?$v['START_TIME']:'该问卷尚未发布';?></td>
              	<td><?php echo $v['END_TIME']?></td>
              	<td>
              		<?php 
              			switch ($v['STATE']) {
              				case 1:echo '<font color="red">未添加题目</font>';break;
              				case 2:echo '<font color="#E57A14">待发布</font>';break;
              				case 3:echo '<font color="green">已发布</font>';break;
              				case 4:echo '<font color="#999999">自动关闭</font>';break;
              				case 5:echo '<font color="#999999">后台关闭</font>';break;
              				default:
              			}?>
              	
              	</td>
              	<td><?php echo $allcate[$v['CAT']]?></td>
              	<td><?php echo $dep[$v['DEP_NO']]?></td>
              	<td>
              	<?php if($v['STATE']!=3){?>
              		<a href="/index.php?c=quesnr&a=edit&id=<?php echo $v['QUES_ID']?>">修改</a> 
              		<?php }?>
              		<a href="/index.php?c=quesnr&a=showquest&id=<?php echo $v['QUES_ID']?>">问卷预览</a> 
              		<?php if($v['STATE']==2){?>
              		<a href="/index.php?c=quesnr&a=issue&id=<?php echo $v['QUES_ID']?>" onclick="return T.confirm('确认发布吗？');">发布</a> 
              		<?php 
	              		}
	              		if(!in_array($v['STATE'], array(4,5))){
              		?>
              		<a href="/index.php?c=quesnr&a=close&id=<?php echo $v['QUES_ID']?>" onclick="return T.confirm('确认关闭吗？');">关闭</a> 
              		<?php }?>
              		<a href="/index.php?c=quesnr&a=del&id=<?php echo $v['QUES_ID']?>" onclick="return T.confirm('确定删除该问卷吗？');">删除</a>
              	</td>
              </tr>
              <?php 
              		}
              	}else{
              ?>
              <tr style="height:40px;color:green;font-size:16px;"><td colspan="10">对不起，你查询的数据不存在！</td></tr>
              <?php 
              	}
              ?>
              <tr><td colspan='10'>
					<?php 
						$url = '/index.php?c=quesnr&a=index&bt='.$bt.'&et='.$et.'&did='.$did.'&cid='.$cid.'&state='.$state.'&title='.urlencode($title).'&p=_num_';
						echo JYTools::pager($url,$tolNum,$page,$pagesize);
					?>
			  </td></tr>
            </table>
        </div>
    </div>
</body>
</html>
<script src="/js/xheditor/jquery/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="/js/boot.js" type="text/javascript"></script>
<script src="/js/tip.js" type="text/javascript"></script>
<script src="/js/add_public_head.js" type="text/javascript"></script>
